<template>
    <div class="likepagecontent">
        <navBar title="我的收藏夹"/>
        <div>
            <van-cell size="large" value="找方剂" />
            <div v-if="this.$root.like2[0] == null">
                <van-empty image="error" description="空空如也" />
            </div>
            <div v-else>
                <div v-for="temp in this.$root.like2" :key="temp">
                    <van-cell :value="data2[temp].name" :to="'/medicine2detail/'+data2[temp].id"/>
                </div>
            </div>
            <van-cell size="large" value="中药知识" />
            <div v-if="this.$root.like3 == []">
                <van-empty image="error" description="空空如也" />
            </div>
            <div v-else>
                <van-empty image="error" description="空空如也" />
            </div>
            <van-cell size="large" value="找中药" />
            <div v-if="this.$root.like1 == []">
                <van-empty image="error" description="空空如也" />
            </div>
            <div v-else>
                <van-empty image="error" description="空空如也" />
            </div>
        </div>
        <div>

        </div>
    </div>
</template>

<script>
import navBar from '../components/navBar.vue'
export default{
    data(){
        return{
            data1:[],
            data2:[]
        }
    },
    components:{
        navBar,
    },
    methods:{
        getdata(){
            this.$axios.get("http://localhost:3000/medicine")
                .then(res =>{
                    // console.log(res.data)
                this.data1=res.data
                // console.log(this.data1)
            })
        },
        getdata2(){
            this.$axios.get("http://localhost:3000/medicinedetail")
                .then(res =>{
                    // console.log(res.data)
                this.data2=res.data
                // console.log(this.data1)
            })
        }
    },
    mounted:function(){
        this.getdata();
        this.getdata2();
        console.log(this.$root.like1)
    }
}

</script>

<style>
.mainpagemedicine_columnbox{
    text-align: center;
    color: #000;
  }
</style>

